package com.aspose.cells.a.d;

public class zdu extends zds {
   private com.aspose.cells.b.a.d.zh b;
   private zbu[] c;
   private int d;
   private byte e;
   private int f;

   public zdu(com.aspose.cells.b.a.d.zm var1) {
      super(var1);
      this.a = var1;
      this.c = new zbu[5021];

      for(int var2 = 0; var2 < 5021; ++var2) {
         this.c[var2] = new zbu();
      }

   }

   public void b(byte[] var1, int var2, int var3) throws Exception {
      this.b = new com.aspose.cells.b.a.d.zh(var1, var2, var3);
      this.m();
      this.n();
      this.p();
   }

   private void m() {
      this.d = 0;
      this.e = -128;
      this.f = 9;
   }

   private void n() {
      for(int var1 = 0; var1 < this.c.length; ++var1) {
         this.c[var1].a((int)-1);
      }

   }

   private void o() throws Exception {
      if ((this.e & 255) != 128) {
         this.a.a((byte)this.d);
      }

   }

   private void a(boolean var1) throws Exception {
      if (var1) {
         this.d |= this.e;
      }

      this.e = (byte)((this.e & 255) >> 1);
      if (this.e == 0) {
         this.a.a((byte)this.d);
         this.d = 0;
         this.e = -128;
      }

   }

   private void a(int var1) throws Exception {
      for(int var2 = 1 << this.f - 1; var2 != 0; var2 >>= 1) {
         this.a((var2 & var1) != 0);
      }

   }

   private void p() throws Exception {
      int var3 = 258;
      int var2 = this.b.c();
      if (var2 == -1) {
         var2 = 257;
      }

      this.a(256);

      int var1;
      while((var1 = this.b.c()) != -1) {
         int var4 = this.a(var2, var1);
         if (var3 == 1 << this.f) {
            if (this.f < 12) {
               ++this.f;
            } else {
               var3 = 258;
               this.n();
               this.a(256);
               this.f = 9;
            }
         }

         if (this.c[var4].a() != -1) {
            var2 = this.c[var4].a();
         } else {
            this.c[var4].a(var3++);
            this.c[var4].b(var2);
            this.c[var4].a((byte)var1);
            this.a(var2);
            var2 = var1;
         }
      }

      this.a(var2);
      this.a(257);
      this.o();
   }

   private int a(int var1, int var2) {
      int var3 = var2 << this.f - 8 ^ var1;
      int var4 = var3 == 0 ? 1 : 5021 - var3;

      while(true) {
         zbu var5 = this.c[var3];
         if (var5.a() == -1 || var5.b() == var1 && var5.c() == (byte)var2) {
            return var3;
         }

         var3 -= var4;
         if (var3 < 0) {
            var3 += 5021;
         }
      }
   }

   public void a() throws Exception {
      super.a();
   }
}
